package com.qzdsoft.erpcloud.service.stock.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.qzdsoft.erpcloud.domain.stock.StockStore;
import com.qzdsoft.erpcloud.mapper.stock.StockStoreMapper;
import com.qzdsoft.erpcloud.service.stock.StockStoreService;
import com.qzdsoft.vo.TypeInfo;

@Service
public class StockStoreServiceImpl implements StockStoreService
{
    @Autowired
    StockStoreMapper stockStoreMapper;
    
    public List<StockStore> selectByComId(Integer companyId)
    {
        StockStore record = new StockStore();
        record.setCompanyId(companyId);
        return stockStoreMapper.select(record);
    }

    @Override
    public List<TypeInfo> selectStockStore(Integer companyid)
    {
        StockStore record = new StockStore();
        record.setCompanyId(companyid);
        List<StockStore> stores = stockStoreMapper.select(record);
        List<TypeInfo> storeTypes = new ArrayList<>();
        for(StockStore s:stores) {
            storeTypes.add(new TypeInfo(s.getId()+"", s.getName()));
        }
        return storeTypes;
    }

}
